import React from 'react'
import {useLocation,useParams} from 'react-router-dom'
import qs from 'qs';
export default function List() {
    const getData = useLocation();
    const {user} = qs.parse(getData.search.split('?')[1])
    const data = getData.state;
    const {id} = useParams();
  return (
    <div>
        <p>我是{user}，我一般{id}</p>
        {
          data.map(item => {
            return <li key={item.id}>{item.name}</li>
          })
        }
    </div>
    
  )
}